home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.20041116-20060924
/
000117_fdc@columbia.edu_Fri Jun 24 10:10:24 2005.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
3KB
Path: newsmaster.cc.columbia.edu!not-for-mail
From: Frank da Cruz <fdc@columbia.edu>
Newsgroups: comp.protocols.kermit.misc
Subject: Re: Iterating Through a Dialing Directory
Date: 24 Jun 2005 14:09:12 GMT
Organization: Columbia University
Lines: 51
Message-ID: <slrndbo508.6l8.fdc@sesame.cc.columbia.edu>
References: <1119556401.918892.120180@g14g2000cwa.googlegroups.com>
Reply-To: fdc@columbia.edu
NNTP-Posting-Host: sesame.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 1119622152 17679 128.59.59.56 (24 Jun 2005 14:09:12 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 24 Jun 2005 14:09:12 GMT
User-Agent: slrn/0.9.8.0 (SunOS)
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:15358
On 2005-06-23, Allen <amtekdesign@gmail.com> wrote:
: I'm trying to use Kermit 95 on a WinXP host to modem dial a group of
: point-of-sale devices. I'd like to set up the phone numbers in a
: dialing directory and then have a script loop through the directory,
: calling each device and downloading sales data, until each device has
: been polled. It seems like there should be an easy way to do this, but
: I can't find anything short of using normal file I/O to scan the
: directory file, pull out each name, and give it to the dial command.
:
Right, there is no built-in function to step through a dialing directory.
I would say that the way you are doing it is appropriate, but I also think
it would be good if Kermit had a programmatic way to access the
dialing-directory filename list, and also programmatic access to its own
functions for reading the entries (stripping comments and whatnot); I'll
add these to my list. Meanwhile, here's a short script that reads and
parses a dialing directory file. It accounts for {Entry Names Containing
Spaces}, blank lines, comment lines, and trailing comments:
#!/usr/local/bin/kermit +
if not def \%1 exit 1 "Usage: \%0 dialing-directory-filename"
fopen /read \%c \fcontents(\%1) # Open the file
if fail exit 1
define parse { # Parse dialing directory entry
.name := \%1 # Entry name
shift # Shift past name
.number := \%* # Phone number is the rest
.\%9 := \findex(\32;,\m(number)) # Strip any trailing comment
if \%9 .number := \ftrim(\s(number[1:\%9]))
}
.\%n = 0 # Entry counter
while true {
fread /line \%c line # Read a line
if fail break # End of file
.line := \ftrim(\fltrim(\m(line))) # Remove any surrounding spaces
if not def line continue # Skip blank lines
if eq "\s(line[1:1])" ";" continue # Skip comment lines
if eq "\s(line[1:1])" "#" continue # Ditto
parse \m(line) # Parse and count the entry
incr \%n
echo "\%n. [\m(name)] = [\m(number)]"
}
fclose \%c
exit 0 "Records: \%n"
Replace the ECHO command with a call to any macro or script file that
you want to make the call and do the work.
- Frank